package com.engineering.elink.service;


import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.engineering.elink.co.UserCo;
import com.engineering.elink.domain.Certification;
import com.engineering.elink.domain.Feedback;
public interface UserService {
	public void saveCachePhoneVerifyCode (String verifyToken,String verifyCode, String phone);
	public void sendPhoneVerifyCode (String phone, String phoneVerifyCode);
	
	
	/**
	 * 检查令牌是否存在 不存在则添加
	 */
	public String refreshAuthToken (String userId);
	
	/**
	 * 手机注册
	 * @param user
	 * @return
	 */
	public Map<String,Object> reg (UserCo userCo);
	
	public boolean forgetPassByPhone (String phone,String verifyToken, String verifyCode);
	
	/**
	 * 检查手机号是否存在
	 * @param phone
	 * @return
	 */
	public boolean checkPhone (String phone);
	
	/**
	 * 检查邮箱是否存在
	 * @param email
	 * @return
	 */
	public boolean checkEmail (String email);
	
	/**
	 * 生成随机验证码并生成随机种子一并存入缓存中 缓存策略为verifyCodeCache
	 * @param verifyCode
	 * @return
	 */
	public void generateVerifyCode (int dbNum, String verifyToken, String verifyCode, int validTime);
	
	/**
	 * 检查注册验证码是否正确
	 * @param verifyCode
	 * @param verifyToken
	 * @param phone
	 * @return
	 */
	public boolean checkVerifyCode (int dbNum, String verifyToken, String verifyCode);
	
	/**
	 * 修改密码
	 * @param userId
	 * @param passwd
	 * @return
	 */
	public boolean modifyPasswd (String userId, String passwd, String newPasswd);
	
	/**
	 * 校验身份三步 只用做修改邮箱和修改手机号这两个流程里
	 * @param verifyToken
	 * @param verifyCode
	 */
	public void checkAuthWithVerifyCode(int checkMethod, String verifyToken, String verifyCode);
	public boolean checkAuthWithSendCode(String phoneOrEmail, String verifyToken, String verifyCode,HttpServletRequest request);
	public boolean checkAuthWithCheckCode(String phoneOrEmail, String verifyToken, String verifyCode);

	public boolean modifyEmailOrPhoneWithVerifyCode (int newCheckMethod, String verifyToken, String verifyCode);
	public boolean modifyEmailOrPhoneWithSendCode (String newPhoneOrEmail, String verifyToken, String verifyCode,HttpServletRequest request);
	public boolean modifyEmailOrPhoneWithCheckCode(String newPhoneOrEmail, String verifyToken, String verifyCode);
	
	public boolean modifyPasswdByEmailOrPhone (String passwd, String verifyToken);
	
	/**
	 * 用户添加意见反馈
	 * @param feedBack
	 * @return
	 */
	public void addFeedBack(Feedback feedBack);
	
	public boolean logOut (String userId);
	
	public Map<String,Object> getBaseUserInfo(String userId);
	
	public Certification getCertification(String userId);
	
	public Map<String, Object> addCertification(Certification cer);

}

